@@ -24,30 +24,40 @@ describe('Object Storage service', () => {
2424
2525 const body = await client . getObjectStoragePlanById ( 'plan_123' , 'eur' ) ;
2626
27- expect ( callStub . firstCall . args ) . toEqual ( [ '/object-storage-plan-by-id ?planId=plan_123¤cy=eur' , headers ] ) ;
27+ expect ( callStub . firstCall . args ) . toEqual ( [ '/object-storage/price ?planId=plan_123¤cy=eur' , headers ] ) ;
2828 expect ( body ) . toEqual ( { id : 'plan_123' } ) ;
2929 } ) ;
3030 } ) ;
3131
3232 describe ( 'Create customer for object storage' , ( ) => {
3333 it ( 'When create customer is requested, then it should call with right params & return data' , async ( ) => {
34- const callStub = sinon . stub ( httpClient , 'post ' ) . resolves ( {
34+ const callStub = sinon . stub ( httpClient , 'get ' ) . resolves ( {
3535 customerId : 'cus_123' ,
3636 } ) ;
3737 const { client, headers } = basicHeadersAndClient ( ) ;
3838
39- const body = await client . createCustomerForObjectStorage ( {
40- name : 'test' ,
39+ const body = await client . getObjectStorageCustomerId ( {
40+ customerName : 'test' ,
41+ postalCode : '123456' ,
4142 email : 'test@test.com' ,
4243 country : 'US' ,
4344 companyVatId : '1234567890' ,
4445 } ) ;
4546
46- expect ( callStub . firstCall . args ) . toEqual ( [
47- '/create-customer-for-object-storage' ,
48- { name : 'test' , email : 'test@test.com' , country : 'US' , companyVatId : '1234567890' } ,
49- headers ,
50- ] ) ;
47+ const customerName = 'test' ;
48+ const postalCode = '123456' ;
49+ const email = 'test@test.com' ;
50+ const country = 'US' ;
51+ const companyVatId = '1234567890' ;
52+
53+ const query = new URLSearchParams ( ) ;
54+ query . set ( 'customerName' , customerName ) ;
55+ query . set ( 'email' , email ) ;
56+ query . set ( 'postalCode' , postalCode ) ;
57+ query . set ( 'country' , country ) ;
58+ query . set ( 'companyVatId' , companyVatId ) ;
59+
60+ expect ( callStub . firstCall . args ) . toEqual ( [ `/object-storage/customer?${ query . toString ( ) } ` , headers ] ) ;
5161 expect ( body ) . toEqual ( { customerId : 'cus_123' } ) ;
5262 } ) ;
5363 } ) ;
@@ -62,22 +72,19 @@ describe('Object Storage service', () => {
6272
6373 await client . createObjectStorageSubscription ( {
6474 customerId : 'cus_123' ,
65- plan : { id : 'plan_123' , bytes : 1000 , interval : 'month' , amount : 1000 , currency : 'eur' , decimalAmount : 10.0 } ,
75+ priceId : 'price_id' ,
76+ currency : 'eur' ,
6677 token : 'token' ,
67- companyName : 'test' ,
68- vatId : '1234567890' ,
6978 promoCodeId : 'promo_123' ,
7079 } ) ;
7180
7281 expect ( callStub . firstCall . args ) . toEqual ( [
73- '/create-subscription-for- object-storage' ,
82+ '/object-storage/subscription ' ,
7483 {
7584 customerId : 'cus_123' ,
76- priceId : 'plan_123 ' ,
85+ priceId : 'price_id ' ,
7786 token : 'token' ,
7887 currency : 'eur' ,
79- companyName : 'test' ,
80- companyVatId : '1234567890' ,
8188 promoCodeId : 'promo_123' ,
8289 } ,
8390 headers ,
0 commit comments