Skip to content

Commit 6c95048

Browse files
committed
feat(payment): PAYPAL-4937 url updates
1 parent 98337a4 commit 6c95048

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

packages/core/src/payment/payment-method-action-creator.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ describe('PaymentMethodActionCreator', () => {
210210

211211
expect(
212212
paymentMethodRequestSender.loadPaymentWalletWithInitializationData,
213-
).toHaveBeenCalledWith(methodId, undefined, undefined);
213+
).toHaveBeenCalledWith(methodId, undefined);
214214
});
215215

216216
it('loads payment wallet method with timeout', async () => {
@@ -228,7 +228,7 @@ describe('PaymentMethodActionCreator', () => {
228228

229229
expect(
230230
paymentMethodRequestSender.loadPaymentWalletWithInitializationData,
231-
).toHaveBeenCalledWith(methodId, undefined, options);
231+
).toHaveBeenCalledWith(methodId, options);
232232
});
233233

234234
it('emits actions if able to load payment wallet method', async () => {

packages/core/src/payment/payment-method-action-creator.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,16 @@ export default class PaymentMethodActionCreator {
165165
methodId: string,
166166
options?: RequestOptions & ActionOptions,
167167
): ThunkAction<LoadPaymentMethodAction, InternalCheckoutSelectors> {
168-
return (store) =>
168+
return () =>
169169
Observable.create((observer: Observer<LoadPaymentMethodAction>) => {
170-
const state = store.getState();
171-
const host = state.config.getHost();
172-
173170
observer.next(
174171
createAction(PaymentMethodActionType.LoadPaymentMethodRequested, undefined, {
175172
methodId,
176173
}),
177174
);
178175

179176
this._requestSender
180-
.loadPaymentWalletWithInitializationData(methodId, host, options)
177+
.loadPaymentWalletWithInitializationData(methodId, options)
181178
.then((response) => {
182179
observer.next(
183180
createAction(

packages/core/src/payment/payment-method-request-sender.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,9 @@ export default class PaymentMethodRequestSender {
5757
*/
5858
loadPaymentWalletWithInitializationData(
5959
methodId: string,
60-
host?: string,
6160
{ timeout }: RequestOptions = {},
6261
): Promise<Response<PaymentMethod>> {
63-
const path = 'get-initialization-data';
64-
const url = host ? `${host}/${path}` : `/${path}`;
62+
const url = `${window.location.origin}/api/wallet-buttons/get-initialization-data`;
6563

6664
const requestOptions: HeadlessPaymentRequestOptions = {
6765
body: {

0 commit comments

Comments
 (0)